package de.ars.client.items.elements;

import javax.microedition.lcdui.Graphics;

import com.sun.lwuit.Font;

import de.ars.client.datahandling.StringSplitter;
import de.ars.client.paintSystems.StringPainter;

public class SmsItem extends ListItem {

	private int smsWidth;
	
	public SmsItem( StringPainter stringPainter, String text )
	{
		super(stringPainter,text);
		smsWidth=195;
	}
	
	public void paint( Graphics g, boolean selected)
	{
		if( selected )
        {
            g.drawRect( 0, 0, this.width + 1, this.height + 1 );
            g.setColor( 0xffffffff );
            g.fillRect( 1, 1, this.width, this.height);
            g.setColor( 0x00000000 );
        }
		String[] temp = StringSplitter.splitLabel(this.font, this.getEditableText(), this.smsWidth);
      	stringPainter.drawMessage( g, temp, 4, (this.height+1-(temp.length-1)*this.font.getHeight())/2-this.font.getHeight()/2,this.font);
	}
	
	public Font getFont()
	{
		return this.font;
	}
	
	public int getSmsWidth()
	{
		return this.smsWidth;
	}

	public boolean getCharOption()
	{
		currentHit = System.currentTimeMillis();
		if (l_lastHit + TIME_GAP_KEY_HIT < currentHit)
		{
			return true;
		}
		return false;
	}
}